package psu.kit;

public class ArrayHandler {
    public int handelArray(int[] array) {
    
        int[] tempArray = new int[array.length];
        
        int nonZero = 0;
        int count = 0;
        
        for (int i = 0; i < array.length; ++i) {
            if (array[i] != 0) {
                ++count;
                
                tempArray[nonZero] = array[i];
                  ++nonZero;
            }
        }
        
        for (int i = 0; i < array.length; ++i) {
               array[i] = tempArray[i];
        }
        
        return count;
    }
}